package com.lengchangjing.ConstructionalPatterns.PrototypePattern;

public class ShallowCloneClient {
    public static void main(String[] args) {
        ClassA classA = new ClassA("name", 50);
        ConcretePrototypeA prototypeA = new ConcretePrototypeA();
        prototypeA.setField1("some");
        prototypeA.setField2(24);
        prototypeA.setClassA(classA);

        // 浅克隆出一个兄弟ConcretePrototypeA对象
        ConcretePrototypeA brother = prototypeA.shallowClone();
        System.out.println(brother == prototypeA);  // return false
        System.out.println(brother.getClassA() == prototypeA.getClassA());  // return true
    }
}
